<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="../vue.js"></script>
</head>

<body>

  <div id="app">


    <div v-if="show">
      gp16-1
    </div>

    <div v-show="show">
      gp16-2
    </div>


    <button v-on:[eventname]="change">
      show button
    </button>

    <hr>

    <div :[attrname]='href'>
      gp16-3
    </div>

    <hr>

    <a href="http://www.baidu.com" @click.prevent="handleClick">link</a>


  </div>

  <script>

    var vm = new Vue({
      el: '#app',
      computed: {
        attrname() {
          return 'data-' + this.dataid;
        }
      },
      data: {
        show: false,
        eventname: 'click',
        dataid: 'img',
        href: "http://www.baidu.com"
      },
      methods: {
        change() {
          this.show = !this.show
        },
        handleClick() {
          console.log('handle click')
        }
      }
    })

  </script>

</body>

</html>